package VN.EDU.IMIC.DEVELOPER.TRINHCAOSANG.ExceptionHandling;
/*Extend the Exception class to create your own ecxeption class.
You don't have to implement anything inside it, no methods are required.
You can have a Constructor if you want.
You can override the toString() function, to display customized message.
*/

public class TestDoTuoi {
	static void validate(int age) throws InvalidAgeException{
		if(age<20)
			throw new InvalidAgeException("Chua du tuoi ket hon");
		else
			System.out.println("Duoc phep ket hon");
	}
	
	public static void main(String args[]){
		try{
			validate(15);
			
		}	catch (Exception e){
			System.out.println(" Exception la : " + e);
			
		}
		
		System.out.println("Other code ....");
	}
}
